package ZoneId_Demo;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.temporal.ChronoUnit;
import java.util.Date;

public class Test04 {
    public static void main(String[] args) throws ParseException {
        //JDK7
        /*String bir = "2004年12月14日";
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy年MM月dd日");
        Date date = simpleDateFormat.parse(bir);
        long birthday = date.getTime();
        long now = System.currentTimeMillis();
        long time = now - birthday;
        System.out.println(time / 1000 / 60 / 60 / 24);*/


        //JDK8
        LocalDate bir = LocalDate.of(2004,12,14);
        LocalDate now = LocalDate.now();
        long time = ChronoUnit.DAYS.between(bir, now);
        System.out.println("我活了" + time + "天");
        System.out.println("我活了" + (time / 365 )+ "年");

    }
}
